package cn.iocoder.boot.mapper;

import cn.iocoder.boot.entity.ComponentStock;
import cn.iocoder.boot.entity.ComponentSupplier;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ComponentSupplierMapper extends BaseMapper<ComponentSupplier> {
    @Select("SELECT STRING_AGG(no, ',') " +
            "FROM (SELECT no FROM kb_component_supplier WHERE deleted = 0 ORDER BY priority ASC LIMIT 3) AS subquery")
    String findPriorityMin3Nos();

    @Update("UPDATE kb_component_supplier SET last_count = day_limit ")
    void reset();
}
